package modules.login.view;

import etc.Language;

import java.awt.Toolkit;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;


@SuppressWarnings("javadoc")
public class LoginFrame extends JFrame
{

	private JTextField usernameField;
	private JPasswordField passwordField;
	private JButton loginButton;

	public LoginFrame()
	{	
		// Window settings
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		this.setTitle(Language.get("Program.Login"));
		int windowWidth = 200;
		int windowHeight = 300;
		int windowX = (int)((Toolkit.getDefaultToolkit().getScreenSize().getWidth() - windowWidth) / 2);
		int windowY = (int)((Toolkit.getDefaultToolkit().getScreenSize().getHeight() - windowHeight) / 2);
		this.setBounds(windowX, windowY, windowWidth, windowHeight);
		this.setLayout(null);
		this.setResizable(false);


		// User field
		JLabel usernameText = new JLabel(Language.get("Program.LoginUsername"));
		usernameText.setBounds(20, 130, 160, 20);
		this.add(usernameText);

		this.usernameField = new JTextField();
		this.usernameField.setBounds(20, 150, 160, 20);
		this.add(this.usernameField);

		// Password field
		JLabel passwordText = new JLabel("Program.LoginPassword");
		passwordText.setBounds(20, 190, 160, 20);
		this.add(passwordText);

		this.passwordField = new JPasswordField();
		this.passwordField.setBounds(20, 210, 160, 20);
		this.add(this.passwordField);

		// Login button
		this.loginButton = new JButton(Language.get("Program.Login"));
		this.loginButton.setBounds(20, 240, 160, 25);
		this.add(this.loginButton);


		// Draw Gui
		setVisible(true);
	}

}
